﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
using Ewts.Code;

namespace Ewts.RDLC
{
    public partial class PDReport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request["insid"] != null && Request["insid"].ToString().Trim()!="")
                {
                    bindReport(int.Parse(Request["insid"].ToString().Trim()));
                }
            }
        }

        public void bindReport(int insid)
        {
            DataTable dt = new DataLib.BLL.BarCode().GetList("InStrorageID=" + insid.ToString()).Tables[0];
             DataLib.Model.InStorage insmodel = new DataLib.BLL.InStorage().GetModel(insid);
            List<ReportParameter> parameterList = new List<ReportParameter>();
            parameterList.Add(new ReportParameter("reptDate", ((DateTime)insmodel.instoragetime).ToLongDateString()));
            parameterList.Add(new ReportParameter("reptBelong", insmodel.InDepart));
            parameterList.Add(new ReportParameter("reptWrlNo", insmodel.wrlno));
            parameterList.Add(new ReportParameter("LoadNo", insmodel.vloadnum));
            


            ReportDataSource rds = new ReportDataSource("DataSet1", dt);
            ReportViewer1.LocalReport.DataSources.Clear();
            new RDLCPrinter().FillRow(dt, 3, 20, 20);//为列表添加空行
            ReportViewer1.LocalReport.SetParameters(parameterList);
            ReportViewer1.LocalReport.DataSources.Add(rds);
            ReportViewer1.LocalReport.Refresh();
        }
    }
}